﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using EPiServer.Data.Dynamic;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using EPiServer.Shell.Gadgets;

using EPiServer.Shell;


namespace EPiServer.Research.MobileCenter.Core
{
    /// <summary>
    /// Util helps with small features and hardcoded names and variables
    /// </summary>
    public static class GadgetUtil
    {
       
        public static IGadgetFactory GadgetFactory { get; set; }
      
        public static string Cell { get { return "Cell"; } }
        public static string WebView { get { return "WebView"; } }
        public static string StartCell { get { return "StartCell"; } }

        public static string MobileCenterTabName
        {
            get { return "MobileCenter"; }
        }


        /// <summary>
        /// Gets the gadget URL.
        /// </summary>
        /// <param name="gadgetName">Name of the gadget.</param>
        /// <returns></returns>
        internal static string GetGadgetUrl(string gadgetName)
        {
            return "/gadgets/"+gadgetName.Replace(" ", String.Empty);
        }

        /// <summary>
        /// Constructs the icon URL.
        /// </summary>
        /// <param name="iconurl">The iconurl.</param>
        /// <returns></returns>
        internal static string ConstructIconUrl(string iconurl)
        {
            if(String.IsNullOrEmpty(iconurl)){
                iconurl = Paths.ToShellResource("ClientResources/EPi/Widgets/Gadget/gadgeticon.png");
            }
            return iconurl;
        }



     
    }
}
